<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
// $cates = pdo_fetchall("SELECT * FROM " . tablename('zh_yjm_course_cate'));
$item = pdo_get('zh_yjm_banner',array('id'=>$_GPC['id']));
if(checksubmit('submit')){
        $data['title']=$_GPC['title'];
        $data['img']=$_GPC['img'];
        $data['link']=$_GPC['link'];
        $data['sort']=$_GPC['sort'];
        $data['time']=date('Y-m-d H:i:s',time());
        $data['uniacid']=$_W['uniacid'];
        if($_GPC['id']==''){  
            $rst=pdo_insert('zh_yjm_banner',$data);      
            if($rst){
                 message('添加成功！', $this->createWebUrl('banner'), 'success');
            }else{
                 message('添加失败！','','error');
            }
        }else{
             $rst=pdo_update('zh_yjm_banner',$data,array('id'=>$_GPC['id']));
            if($rst){
                 message('编辑成功！', $this->createWebUrl('banner'), 'success');
            }else{
                 message('编辑失败！','','error');
            }
        }
}
include $this->template('web/addbanner');